﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace StreamingClient
{
    public partial class frm_Client : Form
    {
        public frm_Client()
        {
            InitializeComponent();           
        }

        private void 打开本地视频文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            //openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            //openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            //openFileDialog.Filter = "media文件|*.avi|MP3文件|*.mp3|C#文件|*.cs|所有文件|*.*";
            openFileDialog.Filter = "视频文件(*.dat;*.mpg;*.avi;*.wmv;*.wma;*.mpeg;*.wov;*.wm)|*.dat;*.mpg;*.avi;*.wmv;*.wma;*.mpeg;*.wov;*.wm|音频文件(*.wav;*.mp3;*.snd;*.au;*.midi;*.mid)|*.wav;*.mp3;*.snd;*.au;*.midi;*.mid|所有文件(*.*)|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string fName = openFileDialog.FileName;
                axWindowsMediaPlayer1.URL = fName;
                axWindowsMediaPlayer1.stretchToFit = true;//设置全屏播放
                axWindowsMediaPlayer1.GetContainerControl();
                axWindowsMediaPlayer1.Ctlcontrols.play();
            }
        }

        private void 打开流媒体ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //mms://192.168.184.128/cyw/legacy_content_clip.wmv
            axWindowsMediaPlayer1.URL = comboBox1.Text;
        }      
    }
}
